import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'


// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  base: '/redis/',
  server: {
    port: 5173,
    proxy: {
      '/redisAPI': {
        // target: 'http://127.0.0.1:8058/redisAPI',
        target: 'https://zzjtpp.top/redisAPI',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/redisAPI/, '')
      },
      '/ChatGPT': {
        target: 'https://zzjtpp.top/ChatGPT',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/ChatGPT/, '')
      }
    }
  },
  resolve: {
    alias: {
      '@': path.resolve(path.resolve(process.cwd()), 'src'),
      '~': path.resolve(process.cwd())
    }
  },
  build: {
    outDir: 'redis'
  }
})
